]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
eslint: (Mostly) synchronize configuration with gjs
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 12 Aug 2021 15:12:15 +0000 (17:12 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 24 Aug 2021 08:13:19 +0000 (08:13 +0000)
In addition to the changes in this commit, gjs now
restricts the use of the Format module and initFormat.
We can't really replace those for translatable strings
until xgettext gains support for template strings, so
leave that bit out for now.

The other notable change is that gjs now requires
jsdoc comments. We can't plainly enable those options
without a massive amount of work first, but let's see
how requiring doc comments for new code goes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1949>

lint/eslintrc-gjs.yml
lint/eslintrc-legacy.yml

index 13114fa7e2814b2f4e15cac8fc57214bc550806c..ba6c5103148061208b2d5fcfdc50e60bc34c723d 100644 (file)
@@ -1,8 +1,12 @@
 ---
 # SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
+# SPDX-FileCopyrightText: 2018 Claudio André <claudioandre.br@gmail.com>
 env:
   es6: true
+  es2020: true
 extends: 'eslint:recommended'
+plugins:
+  - jsdoc
 rules:
   array-bracket-newline:
     - error
@@ -60,6 +64,17 @@ rules:
       - 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child'
       # Allow dedenting chained member expressions
       MemberExpression: 'off'
+  jsdoc/check-alignment: error
+  jsdoc/check-param-names: error
+  jsdoc/check-tag-names: error
+  jsdoc/check-types: error
+  jsdoc/implements-on-classes: error
+  jsdoc/newline-after-description: error
+  jsdoc/require-jsdoc: error
+  jsdoc/require-param: error
+  jsdoc/require-param-description: error
+  jsdoc/require-param-name: error
+  jsdoc/require-param-type: error
   key-spacing:
     - error
     - beforeColon: false
@@ -107,6 +122,7 @@ rules:
   no-octal-escape: error
   no-proto: error
   no-prototype-builtins: 'off'
+  no-restricted-globals: [error, window]
   no-restricted-properties:
     - error
     - object: Lang
@@ -167,6 +183,7 @@ rules:
   object-curly-newline:
     - error
     - consistent: true
+      multiline: true
   object-curly-spacing: error
   object-shorthand: error
   operator-assignment: error
@@ -214,14 +231,14 @@ rules:
   template-curly-spacing: error
   template-tag-spacing: error
   unicode-bom: error
-  valid-jsdoc:
-    - error
-    - requireReturn: false
   wrap-iife:
     - error
     - inside
   yield-star-spacing: error
   yoda: error
+settings:
+  jsdoc:
+    mode: typescript
 globals:
   ARGV: readonly
   Debugger: readonly
@@ -233,5 +250,8 @@ globals:
   logError: readonly
   print: readonly
   printerr: readonly
+  window: readonly
+  TextEncoder: readonly
+  TextDecoder: readonly
 parserOptions:
   ecmaVersion: 2020
index 55e9a2bb85cf30ba4b17d36ac84adde0f36fa76e..8441f7c2d5e4a51e0ec7b7a0d9e53bd2fcae2d63 100644 (file)
@@ -10,5 +10,19 @@ rules:
       ArrayExpression: first
       ObjectExpression: first
       MemberExpression: off
+  jsdoc/check-alignment: off
+  jsdoc/check-param-names: off
+  jsdoc/check-tag-names: off
+  jsdoc/check-types: off
+  jsdoc/implements-on-classes: off
+  jsdoc/newline-after-description: off
+  jsdoc/require-jsdoc: off
+  jsdoc/require-param: off
+  jsdoc/require-param-description: off
+  jsdoc/require-param-name: off
+  jsdoc/require-param-type: off
+  object-curly-newline:
+    - error
+    - consistent: true
   prefer-template: off
   quotes: off